<?php
session_start();
include 'funktionen.inc.php';

if (logged_in()){
    If (isset($_POST["abschicken"]) AND ($_POST["newpwd"] <> '')){
      // Cookie löschen
      setcookie('translateautoit','',time()-8400);
      //Passwort in der Datenbank ändern
      echo changeDBpassword($_POST["oldpwd"], $_POST["newpwd"],$_POST["newpwdretype"], $_SESSION["username"]);
      // Cookie neu setzen
      setcookie('translateautoit',$_SESSION['username'].','.md5($_SESSION['username']).md5($_SESSION['userpass']),time()+60*60*2*4*30);
      die(header('Location: ./index.php'));
    }else{ 
      $errTxt = '';
      
      if(isset($_GET["error"]) OR (isset($_POST["abschicken"])) ){$errTxt = '<font color="#0b6295" size="3"><b>Die Eingabe war leider falsch.</b></font> ';}
      echo'<head>
            <link rel="stylesheet" type="text/css" href="css/css.css">
            <title>HelpTranslation f&uuml;r www.autoit.de</title>
          </head><body>
            <h1><br>Benutzer Passwort &auml;ndern</h1>';
      include('header.php');
      echo '<br><center>
            <form method="post" action="./changepassword.php">
              <table border="0" bgcolor="#FFFFFF">       
                <tr bgcolor="#FFFFFF">        
                  <td align="right" bgcolor="#FFFFFF"><label>Altes Passwort:</label></td> 
                  <td bgcolor="#FFFFFF"><input name="oldpwd" type="password" size="30"></td>         
                </tr>
                <tr bgcolor="#FFFFFF">        
                  <td align="right" bgcolor="#FFFFFF"><label>Neues Passwort:</label></td> 
                  <td bgcolor="#FFFFFF"><input name="newpwd" type="password" size="30"></td>         
                </tr>
                <tr bgcolor="#FFFFFF">        
                  <td align="right" bgcolor="#FFFFFF"><label>Passwort wiederholen:</label></td> 
                  <td bgcolor="#FFFFFF"><input name="newpwdretype" type="password" size="30"></td>    
                </tr>
                <tr bgcolor="#FFFFFF">        
                  <td align="right" bgcolor="#FFFFFF" colspan="2">'.$errTxt.'<input name="abschicken" type="submit" id="abschicken" value="Abschicken"></td>
                </tr>    
              </table>
            </form></center>';
      include('footer.php');
    }
}else{
     header('Location: ./index.php'); 
     //bgcolor="#0b6295"
}
?> 
